package com.edu.statisticsservice.controller;


import com.edu.commonutils.R;
import com.edu.statisticsservice.service.StatisticsDailyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author ljw
 * @since 2022-09-27
 */

@Api(description = "统计分析接口")
//@CrossOrigin
@RestController
@RequestMapping("/statisticsservice/statisticsdaily")
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService dailyService;


    @ApiOperation("添加某一天统计数据")
    @PostMapping("/get/{day}")
    @ResponseBody
    public R get(@PathVariable String day){
        //把人数统计到统计分析表
        dailyService.getDay(day);

        return R.ok();
    }

    @PostMapping("/showdata/{type}/{begin}/{end}")
    @ResponseBody
    public R show(@PathVariable String type,@PathVariable String begin,@PathVariable  String end ){

        //根据类型 开始时间 结束时间查询 显示图形
      Map<String,Object> map=  dailyService.showData(type,begin,end);
        //返回数据
        return R.ok().data(map);
    }


}

